import {HttpRequest} from "@/network";
import {ApiConst} from "@/network/config/ApiConst";
import AppConfig from "@/config/AppConfig";

let env = AppConfig.env;
export default class ShopService {
  static async getShopInfoById(id) {
    let promise = HttpRequest.get({
      url: env === 'mock' ?
        ApiConst.shop.mock.get[`GET_SHOP_INFO_BY_ID_${id}`]
        :
        ApiConst.shop.dev.get.GET_SHOP_INFO_BY_ID + id,
      env: env,
    }).then(res => {
      if (res.err === null) {
        return res.data.data
      }
    }).catch(err => {
      console.error("请求出错。");
      throw err;
    })
    return await promise;
  }
}
